package com.lyl.quartz.test;

import com.lyl.quartz.jobs.HelloDataJob;
import org.junit.jupiter.api.Test;
import org.quartz.*;
import org.quartz.impl.StdSchedulerFactory;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.concurrent.TimeUnit;

/**
 * 配置文件
 * @author lylbell
 * @date 2022-03-29 10:35
 */
@SpringBootTest
public class _06_QuartzTest_Properties {


    @Test
    public void context() throws SchedulerException, InterruptedException {
        // 调度器工厂创建默认调度器
        Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();

        // 启动调度器
        scheduler.start();

        // 获取配置文件中的数据
        System.out.println("scheduler_name " +scheduler.getSchedulerName());
        System.out.println("线程池 " + scheduler.getMetaData().getThreadPoolSize());

        scheduler.shutdown();
    }
}
